UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W8DDqv4vH9MMsIKl4dXVI1Qdiz+fI7v3ADaYnEhYQCU=' 
WHERE 
  key_id = '13aa5717125eb83c747f8ca5650414cd75d3bb79a067d51403d21aba3d894ac9' 
  AND (
    token = 'W8DDqv4vH9MMsIKl4dXVI1Qdiz+fI7v3ADaYnEhYQCU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043