UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AitEaHmqiVq4Eoa2qR6VMJp9Bz5kEL2GfVr6GxV0VCg='
WHERE
key_id = '4f164f45fad951a2c4abe009802a82f2ebb4755c9a9354e32e4d249a58636b1a'
AND (
token = 'AitEaHmqiVq4Eoa2qR6VMJp9Bz5kEL2GfVr6GxV0VCg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)