UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IG1l22rDKKjDalIClgFOq5WhYZ4ZRE0mL1ON1y1aR+g='
WHERE
key_id = 'de43e013a5cd772f0d0c2d4d555c8d3818ba64f5e5057af35700b83ed01806d9'
AND (
token = 'IG1l22rDKKjDalIClgFOq5WhYZ4ZRE0mL1ON1y1aR+g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)