UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BJDI058U77r8EYxVQZl4zX/aJHZZXBSrLAubCUzqBPE=' 
WHERE 
  key_id = 'c1abca5114ee9cc7de2bdc3753cde0f946cfcc60286892e53f0dfe797c5e94e6' 
  AND (
    token = 'BJDI058U77r8EYxVQZl4zX/aJHZZXBSrLAubCUzqBPE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030