UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ohPFVq7WQsrH1kUiOCL7RDv9GcxJ2MtZ7iiMl1VPr+M=' 
WHERE 
  key_id = 'e4490b4aa89303668d99ef1dd9478abb4fe7c59d022767f960dc592fcab43bb6' 
  AND (
    token = 'ohPFVq7WQsrH1kUiOCL7RDv9GcxJ2MtZ7iiMl1VPr+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028