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