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