UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'muYouV0h7ls4GSfMZtLfLTE4rCLWhw+57hLg4OexiYI='
WHERE
key_id = 'ca01a413fa05cd8b7f7a6d913fdd4b21723f199533055fc0d8b2aa5dbd7a247d'
AND (
token = 'muYouV0h7ls4GSfMZtLfLTE4rCLWhw+57hLg4OexiYI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)