UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NtBMc8N+KkleSNL1NcSC9mS6ENToPY0po+1HTLjf+V8=' 
WHERE 
  key_id = 'd746760e39940c816ab24f8fc7e4a167b83e89981e684a67c71a50a5b2537146' 
  AND (
    token = 'NtBMc8N+KkleSNL1NcSC9mS6ENToPY0po+1HTLjf+V8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031