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