UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YPuT2UMelnaqPAa3I5X8fNHqKHFTYTES22GScfWMCbQ='
WHERE
key_id = 'aeae85ac7e0e1c85b019ae148df2a109b87861fd0b2fd4cf13d6306e6b5fc4c7'
AND (
token = 'YPuT2UMelnaqPAa3I5X8fNHqKHFTYTES22GScfWMCbQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)