UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ECSwxO44X3JCM4uJzCVydwgzZ3ob5iAz4y4WKAPujzQ=' 
WHERE 
  key_id = 'f100a34e9a473ce87a15276014ac77fb17fd908adc2121e8cfbf23031dcdcb01' 
  AND (
    token = 'ECSwxO44X3JCM4uJzCVydwgzZ3ob5iAz4y4WKAPujzQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030