UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S5vkBajlTJeqyt38rL3txsBzPGNGme1T/Q1yC9QB7uw='
WHERE
key_id = 'ca60042c5b61acb3c631ffa318ae80e10923f6225893036ba22609bd41fe8c5d'
AND (
token = 'S5vkBajlTJeqyt38rL3txsBzPGNGme1T/Q1yC9QB7uw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)