UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lZbnkNn2CwD+ZWKajUnx7ZTku0QmgUDptOT1vEouyZM='
WHERE
key_id = '05cde6da41b08f3829fe984c9c04469447033858e81998732644d118721503d6'
AND (
token = 'lZbnkNn2CwD+ZWKajUnx7ZTku0QmgUDptOT1vEouyZM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)