UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YH2BFmjzNvOylPlZn3Kxywj+TO3/vE8eSv3OZYUHa9k='
WHERE
key_id = 'dc48d5217651990223aa29bf11514b996926fa920b618976f103de21d7fce036'
AND (
token = 'YH2BFmjzNvOylPlZn3Kxywj+TO3/vE8eSv3OZYUHa9k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)