UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '31vp5XtBrEaMZUJLYi250VBHDifxkxPkEeNhVsfThG0='
WHERE
key_id = '2364fc67f57f2c096600eaa13d1cf06019efdfa5299729da3ea609a996f5b9a0'
AND (
token = '31vp5XtBrEaMZUJLYi250VBHDifxkxPkEeNhVsfThG0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)