UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HTgP59NFlAcQM0mbZRyHiVhP758b+FU+b6otE3A4L0A='
WHERE
key_id = 'f4eaa7bad153d0208249a11e1ea163f02b868e4c64422afc361f57ad0d2da8e2'
AND (
token = 'HTgP59NFlAcQM0mbZRyHiVhP758b+FU+b6otE3A4L0A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)