UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1EI9fplBjXuDyrX5su3CJUrM4Is734uOA+LpNccQm+E=' 
WHERE 
  key_id = 'd8677ed4f7ec699003e08ea3ba6bd379afad70d162b93432954e71d141a1971e' 
  AND (
    token = '1EI9fplBjXuDyrX5su3CJUrM4Is734uOA+LpNccQm+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031