UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KH4BxkxmmoJmXV7/LbwWNpQlWmLFmaMQENwaEcsvZeQ=' 
WHERE 
  key_id = '51a244f1486d510fd1af8836554a808f61073d6af308d86eae3aa4a141830e83' 
  AND (
    token = 'KH4BxkxmmoJmXV7/LbwWNpQlWmLFmaMQENwaEcsvZeQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036