UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6Sgl5x47LyOanqqyTgTGt9CiLIRstFXMOvJ8gaVz7UM='
WHERE
key_id = '4b216421de0c694e6cfd701faefc25f62f6127e3b4bf4d102617dc9b4648d287'
AND (
token = '6Sgl5x47LyOanqqyTgTGt9CiLIRstFXMOvJ8gaVz7UM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)