UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JH4FK5007GpxhhFVqk+GhwKTt+C07XdR3O7uBrzV9Sk='
WHERE
key_id = '77ce4367f582952083f45de853a63c1e8ec27b8f70b098ad646d7893be42b5a4'
AND (
token = 'JH4FK5007GpxhhFVqk+GhwKTt+C07XdR3O7uBrzV9Sk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)