UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Wf30vYa5utrz2JuJI4BnjahJQr7DcGEnwW6zrul01Q0='
WHERE
key_id = '4090599a4085cccc585313e00bbf72999b25b7bfcb177e676336adfaa7f3417e'
AND (
token = 'Wf30vYa5utrz2JuJI4BnjahJQr7DcGEnwW6zrul01Q0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)