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