UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jobH9yCLlU2rff3eYpoQHZyD0BKbtxIaB1ZMNMDms9w='
WHERE
key_id = '77a7aff45a342b5680d052738bd736885125eca131cc5748f7fa2e90405b77f6'
AND (
token = 'jobH9yCLlU2rff3eYpoQHZyD0BKbtxIaB1ZMNMDms9w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)