UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V6y+dh+omhiBNX/DtBBr/Xv7cesfxH50RvUmtNl/4q8='
WHERE
key_id = 'c5959af976146f8d65979cfe3a52cbf05e4ca4b43072d140bebbae28f2ea8ef7'
AND (
token = 'V6y+dh+omhiBNX/DtBBr/Xv7cesfxH50RvUmtNl/4q8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)