UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Fgo9Ha560VlPSWnMw/XzuL6+Fa3pj/0j0s3FliGohcc='
WHERE
key_id = 'b98ad31f29e6edfe28c347b83773e73c5ba58d3458e62f706f5eb754a717d097'
AND (
token = 'Fgo9Ha560VlPSWnMw/XzuL6+Fa3pj/0j0s3FliGohcc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)