UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 's7MciNVopMTe4a9C3tT4Kcs19ksmzy0t3jFJ6+RE8rw='
WHERE
key_id = 'a4516f02f041b79aa6a4b876ef4cdbdff7232484d9e8133c4b4e9b750aa56b31'
AND (
token = 's7MciNVopMTe4a9C3tT4Kcs19ksmzy0t3jFJ6+RE8rw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)