UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pJRxz7sv5MsGt777w/yATLwKXFp7pTpSKP/bzx7CoNQ=' 
WHERE 
  key_id = '2a1c3446442f30308aa71a3a70d2cf166576fd6dca59d758df265be5013eb454' 
  AND (
    token = 'pJRxz7sv5MsGt777w/yATLwKXFp7pTpSKP/bzx7CoNQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029