UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MO5ttDDBL8bLKAian7vztvtEF75QJJgotQkjhRr+a6Y=' 
WHERE 
  key_id = '191fe81bb4e5320d152ef50b7d0f7acf9e7551df7bf6a7748eab23376faca64a' 
  AND (
    token = 'MO5ttDDBL8bLKAian7vztvtEF75QJJgotQkjhRr+a6Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022