UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aEE35mqpjsBClC7gEmIP4eY5nrTR9UuDMvaMcsN/oXI='
WHERE
key_id = '30af69a43a0901c1108329ba69a12b6551decaf15f827c08d8d8e3956c0ba0cd'
AND (
token = 'aEE35mqpjsBClC7gEmIP4eY5nrTR9UuDMvaMcsN/oXI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)