UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YhMRzQf5Sc5v15J3jLpQcA9N2NfHKAGOSXnJAMFmUO0='
WHERE
key_id = '7b6c8d52654915bb862f651946ee26fee16247b6ce545719dde5e5b0d5b4beee'
AND (
token = 'YhMRzQf5Sc5v15J3jLpQcA9N2NfHKAGOSXnJAMFmUO0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)