UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S8sSticnn+o4nwk9dD7sU5SYkrLXIF0d4anAd/GgiE4='
WHERE
key_id = 'd2ae4af52923b60a6be0406fb7200f23ef0c752388cd7f63b3284a946a2cea8d'
AND (
token = 'S8sSticnn+o4nwk9dD7sU5SYkrLXIF0d4anAd/GgiE4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)