UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FAv7nfvSHLJim3/UmOrSjoz+TGyCMU+P6lr2IGvmN2I=' 
WHERE 
  key_id = '74e90d41c060071c1b7b0cccb4a2f7852c205c83d7a90b8590112b3c41c9b068' 
  AND (
    token = 'FAv7nfvSHLJim3/UmOrSjoz+TGyCMU+P6lr2IGvmN2I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037